disp('MEROS_II')
pause;

disp('Askhsh 2')
disp('Or8okanonikopoihsh Gram-Schmidt')
pause;

disp('Geometrikh anaparastash ths klasikhs diadikasias Gram-Schmidt')
pause;
A=rand(2);
[Q,R]=cgs(A,1);
A=rand(3);
[Q,R]=cgs(A,1);

disp('Diafora meta3y ths klasikhs kai ths tropopoihmenhs diadikasias Gram-Schmidt')
pause;
A = rand(5); 
[Q1,R1] = cgs(A,1); 
[Q2,R2] = mgs(A,1);

disp('Trigwnikh or8ogwnopoihsh')
pause;
A=rand(5); 
[Q,R]=mgs(A,2)


disp('Householder')
pause;

disp('Askhsh 3')
pause;
HouseholderDemo2D

disp('Askhsh 4')
disp('Anaparastash tou Householder se 3 diastaseis')
pause;
A = rand(3)
R = hr(A,1)


disp('SVD')
pause;

disp('Askhsh 1')
pause;

Data = { 'Name' 'Height [cm]' 'Weight [kg]' 'Age [y]' 
    'Vladimir' 172 62 30;
    'Ioan' 180 89 28; 
    'Johannes' 184 77 24; 
    'Mario' 178 65 25; 
    'Phil' 192 93 25; 
    'Markus' 181 65 23;
    'Anton' 186 80 23 };

% Get the Height-Weight matrix A 
tmp = Data(2:end,2:end-1); 
A = reshape([tmp{:}], size(tmp) );    % The height-weight matrix

A(:,1) = A(:,1) - mean(A(:,1)); % From each column substract its mean 
A(:,2) = A(:,2) - mean(A(:,2));
 
[U,S,V] = svd(A); % compute SVD 
PC = U*S;   % the principle components

% Plot the data and the principle axes
figure(1); clf;
plot(A(:,1),A(:,2),'o', 'MarkerSize', 10, 'LineWidth', 2); 
xlabel('Height'); ylabel('Weight');
axis equal; box on;

drawSpan(V(:,1), '2g-'); % 1st principle axes
drawSpan(V(:,2), '2m-'); % 2nd principle axes

% Display the coordinate lines 
for ii=1:size(A,1)
drawLine([A(ii,:)' PC(ii,1)*V(:,1)])
drawLine([A(ii,:)' PC(ii,2)*V(:,2)])
end
drawAxes(2,'k'); 
legend('Heigth-Weight data', '1st principle axis', '2nd principle axis', 2)

% Min, max and outlier detection 
disp('The principle components (coordinates):') 
disp(PC)

% Find the largest/smallest person
[tmp, ix1] = max(PC(:,1)); 
[tmp, ix2] = min(PC(:,1));
disp('The largest/smallest persons are:')
disp(Data([ix1 ix2]+1,1))

% Find an outlier
[tmp, ix] = max(abs(PC(:,2))); 
disp('The outlier is:')
disp(Data(ix+1,1) )




disp('Katastash enos provlhmatos kai sta8erothta enos algori8mou')
pause;

disp('Askhsh 1')
pause;

for m = 1:100
    R = triu(rand(m));
    cond(R);
end

m = 50;
R = triu(rand(m));
x = rand(m,1);
b = R*x;
x1 = backSub(R,b);
